package com.day1011.task;

import java.io.*;

//  从文件中读取数据
public class MapReader {
    public static String[][] readMap() throws Exception {
        File file = new File("F:\\task\\1.lvl");
        FileReader fileReader = new FileReader(file);
        BufferedReader bufferedReader = new BufferedReader(fileReader);
        String[][] numArray = new String[11][11];
        String lin = null;
        int index = 0;
        while ((lin = bufferedReader.readLine()) != null){
            String[] strArray = lin.split(",");
            for (int j = 0; j < strArray.length; j++) {
                numArray[index][j] = strArray[j].trim();
            }
            index ++;
        }
        bufferedReader.close();
        fileReader.close();
//        for (int i = 0; i < numArray.length; i++) {
//            for (int j = 0; j < numArray[i].length; j++) {
//                System.out.print(numArray[i][j] + " ");
//            }
//            System.out.println();
//        }
        return numArray;
    }
}
